<?
include_once("_common.php");
@include_once("$g4[path]/lib/mw.builder.lib.php");
include_once("$mw_cash[path]/cybercash.lib.php");

if (!is_numeric($page)) $page = 1;

$sql_common = " from $mw_cash[account_table] ";
$sql_search = " where mb_id = '$member[mb_id]' ";
$sql_order = " order by ac_datetime desc ";

$sql = "select count(*) as cnt
        $sql_common
        $sql_search";
$row = sql_fetch($sql);
$total_count = $row[cnt];

$rows = $config[cf_page_rows];
$total_page  = ceil($total_count / $rows);  // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함  */

$sql = "select *
        $sql_common
        $sql_search
        $sql_order
        limit $from_record, $rows ";
$qry = sql_query($sql);


$list = array();
for ($i=0; $row=sql_fetch_array($qry); $i++) {
    $list[$i] = $row;
    $list[$i][num] = $total_count - ($page - 1) * $rows - $i;
    $list[$i][ac_datetime] = date("Y-m-d", strtotime($list[$i][ac_datetime]));
}

$list_count = count($list);

$write_pages = get_paging($rows, $page, $total_page, "$PHP_SELF?{$qstr}&page=");

$colspan = 5;

$g4[title] = "무통장 신청내역";
include_once("_head.php");
?>
<link rel="stylesheet" href="style.css" type="text/css"/>

<h3 class=title>● <?=$g4[title]?> (입금계좌 : <?=$mw_cash[cf_account_num]?>) </h3>


<div style="height:20px; margin:10px 0 5px 0;">
    <div style="float:left; color:#888;"> 나의 <?=$mw_cash[cf_cash_name]?> :  <?=number_format($mw_cash[mb_cash])?> <?=$mw_cash[cf_cash_unit]?> </div>
    <div style="float:right; color:#888;"> 전체 <?=number_format($list_count)?> 건 </div>
</div>
<table border=0 cellpadding=0 cellspacing=0 width=100% class=data>
<!--<colgroup width="50"/>-->
<colgroup width="100"/>
<colgroup width="100"/>
<colgroup width="100"/>
<colgroup width=""/>
<colgroup width="100"/>
<tr>
    <!--<td class="head"> 번호 </td>-->
    <td class="head"> 날짜 </td>
    <td class="head"> <?=$mw_cash[cf_cash_name]?> </td>
    <td class="head"> 상태 </td>
    <td class="head"> 입금액 </td>
    <td class="head"> 취소 </td>
</tr>

<? for ($i=0; $i<$list_count; $i++) { ?>
<tr>
    <!--<td class="body"> <?=$list[$i][num]?> </td>-->
    <td class="body"> <?=$list[$i][ac_datetime]?> </td>
    <td class="body right"> <?=number_format(mw_payment_to_cash($list[$i][ac_payment], $list[$i][ac_tax]))?> <?=$mw_cash[cf_cash_unit]?> </td>
    <td class="body"> <?=$list[$i][ac_status]?> </td>
    <td class="body right"> <?=number_format($list[$i][ac_payment])?> 원 </td>
    <td class="body">
        <? if ($list[$i][ac_status] == "입금신청") { ?>
        <a href="javascript:if (confirm('정말 취소하시겠습니까?')) location.href='account-del.php?ac_id=<?=$list[$i][ac_id]?>';">[취소]</a>
        <? } else { ?>
        -
        <? } ?>
    </td>
</tr>
<? } ?>
<? if ($i==0) echo "<tr><td colspan=$colspan class=none>자료가 없습니다.</td></tr>"; ?>
</table>


<div class="paging"><?=$write_pages?></div>


<?
include_once("_tail.php");
?>
